package com.heh.mybatisplus.controller;

import com.heh.mybatisplus.model.MyApiResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;

/**
 * @项目名： spring-emq
 * @包名： com.heh.mybatisplus.controller
 * @文件名: ResultfulController
 * @创建者: liufudong@szyh-smart.com
 * @创建时间: 2024/10/20 18:09
 * @描述：
 */
@Slf4j
@RestController
public class ResultFulController {
    @GetMapping("/result/{id}")
    public MyApiResponse getResult(@PathVariable Integer id) {
        MyApiResponse<Integer> success = MyApiResponse.success(id);
        log.info("getResult------>:{}",id);
        return success;

    }
    @GetMapping("/resultList")
    public MyApiResponse getResultList(@RequestParam("ids") List<Integer> ids){
        MyApiResponse<List<Integer>> success = MyApiResponse.success(ids);
        log.info("getResultList------>:{}",success);
        return success;
    }
    @GetMapping("/deleteResultList/{ids}")
    public MyApiResponse deleteResultList(@PathVariable("ids") String ids){
        List<String> idList = Arrays.asList(ids.split(","));

        MyApiResponse<List<String>> success = MyApiResponse.success(idList);
        log.info("deleteResultList------>:{}",idList);
        return success;
    }
}
